﻿using System;
using System.Collections.Generic;
using System.Text;

namespace efish.Framework.Model
{
    public class Order : BaseModel
    {
        public Order() { }

        public Order(int id, DateTime addedDate, string addedBy,
           int statusID, string shippingMethod, decimal subTotal, decimal shipping,
           string shippingFirstName, string shippingLastName, string shippingStreet,
           string shippingPostalCode, string shippingCity, string shippingState,
           string shippingCountry, string customerEmail, string customerPhone, string customerFax,
           DateTime shippedDate, string transactionID, string trackingID)
        {
            this.ID = id;
            this.AddedDate = addedDate;
            this.AddedBy = addedBy;
            this.StatusID = statusID;
            this.ShippingMethod = shippingMethod;
            this.SubTotal = subTotal;
            this.Shipping = shipping;
            this.ShippingFirstName = shippingFirstName;
            this.ShippingLastName = shippingLastName;
            this.ShippingStreet = shippingStreet;
            this.ShippingPostalCode = shippingPostalCode;
            this.ShippingCity = shippingCity;
            this.ShippingState = shippingState;
            this.ShippingCountry = shippingCountry;
            this.CustomerEmail = customerEmail;
            this.CustomerPhone = customerPhone;
            this.CustomerFax = customerFax;
            this.ShippedDate = shippedDate;
            this.TransactionID = transactionID;
            this.TrackingID = trackingID;
        }

        #region Fields

        private DateTime _addedDate = DateTime.Now;
        public virtual DateTime AddedDate
        {
            get { return _addedDate; }
            set { _addedDate = value; }
        }

        private string _addedBy = "";
        public virtual string AddedBy
        {
            get { return _addedBy; }
            set { _addedBy = value; }
        }

        private int _statusID = 0;
        public virtual int StatusID
        {
            get { return _statusID; }
            set { _statusID = value; }
        }

        private string _shippingMethod = "";
        public virtual string ShippingMethod
        {
            get { return _shippingMethod; }
            set { _shippingMethod = value; }
        }

        private decimal _subTotal = 0.0m;
        public virtual decimal SubTotal
        {
            get { return _subTotal; }
            set { _subTotal = value; }
        }

        private decimal _shipping = 0.0m;
        public virtual decimal Shipping
        {
            get { return _shipping; }
            set { _shipping = value; }
        }

        private string _shippingFirstName = "";
        public virtual string ShippingFirstName
        {
            get { return _shippingFirstName; }
            set { _shippingFirstName = value; }
        }

        private string _shippingLastName = "";
        public virtual string ShippingLastName
        {
            get { return _shippingLastName; }
            set { _shippingLastName = value; }
        }

        private string _shippingStreet = "";
        public virtual string ShippingStreet
        {
            get { return _shippingStreet; }
            set { _shippingStreet = value; }
        }

        private string _shippingPostalCode = "";
        public virtual string ShippingPostalCode
        {
            get { return _shippingPostalCode; }
            set { _shippingPostalCode = value; }
        }

        private string _shippingCity = "";
        public virtual string ShippingCity
        {
            get { return _shippingCity; }
            set { _shippingCity = value; }
        }

        private string _shippingState = "";
        public virtual string ShippingState
        {
            get { return _shippingState; }
            set { _shippingState = value; }
        }

        private string _shippingCountry = "";
        public virtual string ShippingCountry
        {
            get { return _shippingCountry; }
            set { _shippingCountry = value; }
        }

        private string _customerEmail = "";
        public virtual string CustomerEmail
        {
            get { return _customerEmail; }
            set { _customerEmail = value; }
        }

        private string _customerPhone = "";
        public virtual string CustomerPhone
        {
            get { return _customerPhone; }
            set { _customerPhone = value; }
        }

        private string _customerFax = "";
        public virtual string CustomerFax
        {
            get { return _customerFax; }
            set { _customerFax = value; }
        }

        private string _transactionID = "";
        public virtual string TransactionID
        {
            get { return _transactionID; }
            set { _transactionID = value; }
        }

        private DateTime _shippedDate = DateTime.MinValue;
        public virtual DateTime ShippedDate
        {
            get { return _shippedDate; }
            set { _shippedDate = value; }
        }

        private string _trackingID = "";
        public virtual string TrackingID
        {
            get { return _trackingID; }
            set { _trackingID = value; }
        }

        #endregion 

        private ICollection<OrderItem> _items;
        public virtual ICollection<OrderItem> Items
        {
            get
            {
                return _items;
            }
            set
            {
                _items = value;
            }
        }

        private string _status = "";
        public virtual string Status
        {
            get { return _status; }
            set { _status = value; }
        }
    }

    public class OrderItem : BaseModel
    {
        public OrderItem() { }

        public OrderItem(int id, int orderID, int productID, string title, 
            string sku, decimal unitPrice, int quantity)
        {
            this.ID = id;
            this.OrderID = orderID;
            this.ProductID = productID;
            this.Title = title;
            this.SKU = sku;
            this.UnitPrice = unitPrice;
            this.Quantity = quantity;
        }

        private int _orderID = 0;
        public virtual int OrderID
        {
            get { return _orderID; }
            set { _orderID = value; }
        }

        private int _productID = 0;
        public virtual int ProductID
        {
            get { return _productID; }
            set { _productID = value; }
        }

        private string _title = "";
        public virtual string Title
        {
            get { return _title; }
            set { _title = value; }
        }

        private string _sku = "";
        public virtual string SKU
        {
            get { return _sku; }
            set { _sku = value; }
        }

        private decimal _unitPrice = 0.0m;
        public virtual decimal UnitPrice
        {
            get { return _unitPrice; }
            set { _unitPrice = value; }
        }

        private int _quantity = 0;
        public virtual int Quantity
        {
            get { return _quantity; }
            set { _quantity = value; }
        }
    }
}
